package com.gupao.jly521.lazy;

/**
 * @author Jly
 * @date 2018/8/21  15:45
 */
public class LazyThree {

    private boolean inited = false;

    private LazyThree() {
        synchronized (LazyThree.class){
            if(inited == false){
                inited = !inited;
            }else{
                throw new RuntimeException("单例被入侵！");
            }
        }
    }

    public static final LazyThree getInstance(){
        return LAZY.bean;
    }

    private static class LAZY{
        private final static LazyThree bean = new LazyThree();
    }
}
